package homework6;

public class Test1 {
    public static void main(String[] args) {
        //第一种
//        Thread thread = new MyThread();
//        thread.start();

        //第二种
        MyRunnable run = new MyRunnable();
        Thread t = new Thread(run);
        t.start();
    }
}
//第一种方式：继承Thread并重写run方法
//class MyThread extends Thread{
//    public void run(){
//        for (int i=0;i<100;i++){
//            System.out.println("你好！");
//        }
//    }
//}
//第二种方式：实现runnable接口
class MyRunnable implements Runnable{
    public void run() {
        for(int i=0;i<100;i++) {
            System.out.println("你好!");
        }
    }
}
